package cn.easybuy.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.easybuy.dao.BaseDao;
import cn.easybuy.dao.OrderDao;
import cn.easybuy.entity.Order;

public class OrderDaoImpl extends BaseDao implements OrderDao{


	public List<Order> getOrderList() {
		String sql="SELECT * FROM `easybuy_order`";
		List<Order> list =new ArrayList<Order>();
		ResultSet rs =this.exxcuteQuery(sql);
		try {
			while (rs.next()) {
				Order order=new Order();
				order.setId(rs.getInt(1));
				order.setUserId(rs.getInt(2));
				order.setLoginName(rs.getString(3));
				order.setUserAddress(rs.getString(4));
				order.setCreateTime(rs.getDate(5));
				order.setCost(rs.getDouble(6));
				order.setSerialNumber(rs.getString(7));
				list.add(order);
				
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			this.closeAll(connection, pstmt, rs);
		}
		return list;
	}

}
